<?php
class Diagnoza extends CI_Controller {

	public function __construct()
	{
		parent::__construct();
		$this->load->model('diagnoza_model');
		$this->load->library('form_validation');
	}

	public function view($slug)
	{		
     	$this->form_validation->set_rules('diagnoza', 'Diagnóza', 'required');
		
		if ($this->form_validation->run())
		{
			$this->diagnoza_model->zmena_diagnozy($slug, $_POST['diagnoza']);
				redirect('jedalnicek/vypis/'.$slug);
		}		
		
		$data['title'] = 'NIS - Diagnóza';
		$data['pacient'] = $slug;
		//$data['diagnoza'] = $this->diagnoza_model->zmena_diagnozy($slug, $_POST['diagnoza']);
	//	$name = $this->dieta_model->ziskaj_nazov($id);
	//	$data['dieta'] = str_replace('-', ' ', $name);
	//	$data['id'] = $id;
		
		$this->load->view('templates/header', $data);
		$this->load->view('project/diagnoza_view', $data);	
		$this->load->view('templates/footer');
		
	}
	

}